package com.leco.demo.spring.config;

import com.leco.demo.spring.beans.Bean2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author greg
 * @version 2022/10/23
 **/
@Configuration
public class AutowiredInvalidTestConfig {

    @Autowired
    private void testApplicationContext(ApplicationContext applicationContext) {
        System.out.println(">>>>自动注入context: " + applicationContext);
    }

    @Bean
    public Bean2 bean2() {
        return new Bean2();
    }

    @Bean
    public BeanFactoryPostProcessor processor1() {
        return beanFactory -> {
            System.out.println(">>>>执行processor1");
        };
    }
}
